/**
 * Copyright 2011-2011 - Members of the Chaupal Community
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package net.chaupal.Impl.v1.Proof.ConfirmationProtocol;

public class CPAnalysis extends CPSequence {

    private CPAnalysis equivalence = null;
    private boolean coherentConvergence = false;
    private boolean disfunctional = false;
    private boolean confirmed = false;

    /**
     * Simple constructor
     *
     * @param inSeq sequence to initialize
     */
    public CPAnalysis(CPSequence inSeq) {
        super(inSeq);
    }

    public CPAnalysis(String sc) {
        super(sc);
    }

    public final CPAnalysis getEquivalence() {
        if ( equivalence != null ) {
            if ( equivalence.getEquivalence() != null ) {
                setEquivalence(equivalence.getEquivalence());
            }
        }
        return equivalence;
    }

    public synchronized final void setEquivalence(CPAnalysis inEquivalence) {
        // We don't want to create loops
        if ( this != inEquivalence ) {
            this.equivalence = inEquivalence;
        }
    }

    public synchronized final boolean isCoherentConvergence() {
        if ( equivalence != null ) {
            coherentConvergence = equivalence.isCoherentConvergence();
        }
        return coherentConvergence;
    }

    public synchronized final boolean isDisfunctional() {
        if ( equivalence != null ) {
            disfunctional = equivalence.isDisfunctional();
        }
        return disfunctional;
    }

    public synchronized final boolean isConfirmed() {
        if ( equivalence != null ) {
            confirmed = equivalence.isConfirmed();
        }
        return confirmed;
    }

    public synchronized final void setCoherentConvergence(boolean inConv) {
        coherentConvergence = inConv;
    }

    public synchronized final void setDisfunctional(boolean inDys) {
        disfunctional = inDys;
    }

    public synchronized final void setConfirmed(boolean inConf) {
        confirmed = inConf;
    }

}